package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.CategoryParamMapper;
import com.weixing.mall.provider.model.domain.CategoryParam;
import com.weixing.mall.provider.model.dto.CategoryParamDto;
import com.weixing.mall.provider.model.dto.CategoryParamQuery;
import com.weixing.mall.provider.model.vo.CategoryParamVo;
import com.weixing.mall.provider.service.ICategoryParamService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName CategoryParamServiceImpl
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/8/6
 * @Version 1.0
 **/
/**
 * <p>
 * 商品模块-商品类目参数关联表 服务实现类
 * </p>
 *
 * @author Small
 * @since 2019-11-20
 */
@Service
public class CategoryParamServiceImpl extends ServiceImpl<CategoryParamMapper, CategoryParam> implements ICategoryParamService {

    @Override
    public void save(CategoryParamDto categoryParamDto) {
        CategoryParam categoryParam = new CategoryParam();
        BeanUtils.copyProperties(categoryParamDto,categoryParam);
        if (null == categoryParamDto.getId()){
            save(categoryParam);
        }else{
            updateById(categoryParam);
        }
    }

    @Override
    public List<CategoryParamVo> selectList(CategoryParamQuery categoryParamQuery) {
        return baseMapper.selectList(categoryParamQuery);
    }
}
